package com.gxuwz.library_consumer.service;

import com.github.pagehelper.PageInfo;
import com.gxuwz.commonmodule.entity.BorrowRecord;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Component
@FeignClient(value = "borrow-provider")
public interface BorrowService {

    //    /**
//     * 借阅书籍
//     * @param bookID
//     */
//    @GetMapping("/borrow/{bookID}")
//    public void borrow(@PathVariable("bookID") String bookID);

    /**
     * 查询所有借阅记录信息
     * @param borrowRecord
     * @return
     */
    @GetMapping("/borrowList")
    public List<BorrowRecord> borrowList(@RequestBody BorrowRecord borrowRecord);

    /**
     * 添加借阅记录信息
     * @param borrowRecord
     */
    @PostMapping( "/borrowAdd")
    public void borrowAdd(@RequestBody BorrowRecord borrowRecord);

    /**
     * 通过ID删除借阅记录信息
     * @param borrowID
     */
    @DeleteMapping("/delete/{borrowID}")
    public void deleteBorrowRecord (@PathVariable("borrowID")Integer borrowID);

    /**
     * 通过ID 查询借阅记录信息
     * @param borrowID
     * @return
     */
    @GetMapping("/gets/{borrowID}")
    public BorrowRecord findByIds(@PathVariable("borrowID")Integer borrowID);

    /**
     * 更新借阅记录信息
     * @param borrowRecord
     */
    @PutMapping("/borrowUpdate")
    public void updateBorrowRecord(@RequestBody BorrowRecord borrowRecord);

    /**
     * 分页查询借阅记录信息
     * @param pageIndex
     * @param pageSize
     * @return
     */
    @GetMapping("/findPages")
    PageInfo findPages(@RequestParam(value = "pageIndex") int pageIndex, @RequestParam(value = "pageSize") int pageSize);
}
